package Lee_code;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author blh
 * @date 2024年08月08日 8:28
 */
public class Lee_567_88 {
    public boolean checkInclusion(String s1, String s2) {
        int len1 = s1.length();
        int len2 = s2.length();
        if (len1 > len2) {
            return false;
        }
        List<Character> list = new ArrayList<>();
        char[] target = s1.toCharArray();
        Arrays.sort(target);
        int slow = 0;
        for (int i = 0; i < len2 - len1 + 1; i++) {
            String sub = s2.substring(i, i + len1);
            char[] temp = sub.toCharArray();
            Arrays.sort(temp);
            if (Arrays.equals(temp, target)){
                return true;
            }
        }
        return false;
    }
}
